package com.example.chat2.controller;

import com.example.chat2.common.Result;
import com.example.chat2.domain.PriMessageDetail;
import com.example.chat2.service.PriMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;






@RestController
@RequestMapping("api")
public class PriMessageController {

    private final PriMessageService priMessageService;

    @Autowired
    public PriMessageController(PriMessageService priMessageService) {
        this.priMessageService = priMessageService;
    }

    @GetMapping("/ChatMessage")
    public Result getPriMessageDetailsWithSchoolchats() {
        List<PriMessageDetail> details = priMessageService.findPriMessageDetailsWithSchoolchats();
        return Result.OK("成功", details);
    }
}